package org.acghub.mtdb.core;

import org.acghub.mtdb.common.Lifecycle;

import java.util.Collection;

/**
 * @author zhouhe
 */
public interface TableCache<K, V> extends Lifecycle<Table<K, V>> {

    int capacity();

    int size();

    org.acghub.mtdb.core.Table<K, V> table();

    boolean exists(K key);

    TRecord<K, V> get(K key);

    void add(K key, TRecord<K, V> record, boolean log);

    void remove(K key);

    Collection<TRecord<K, V>> values();

    void truncate();
}
